<template>
  <div class='container'>
    <el-dialog title="预览文章" width="40%" :visible="previewDialog" @close="closePreviewDialog">
      <h2>{{articleDetail.title}}</h2>
     <div class="autAndTime">
        <span>{{articleDetail.createTime}}</span>
        <span>{{articleDetail.username}}</span>
        <span><i class="el-icon-view"></i>{{articleDetail.visits}}</span>
      </div>
      <div class="content">
        <div v-html="articleDetail.articleBody"></div>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  props: {
    previewDialog: {
      type: Boolean,
      required: true
    }
  },
  data () {
    return {
      articleDetail: {}
    }
  },
  methods: {
    closePreviewDialog () {
      this.$emit('update:previewDialog', false)
    }
  }
}
</script>

<style scoped lang='scss'>
  h2{
  margin: 0;
 }
.autAndTime{
  margin: 10px 0;
  span{
    margin: 6px;
  }
}
.content{
  background-color: #f5f5f5;
  padding: 20px 10px;
  border-top: 1px dashed #ccc;
}
</style>
